-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: enable clippy as_conversions lint across workspace #5577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: enable clippy as_conversions lint across workspace #5577
Conversation
Signed-off-by: Aryan Behmardi <[email protected]>
|
Hi @arianbeh, Thank you for your contribution, this definitely looks like a good QoL change for us. The only thing I'd suggest as an improvement is to use I'll leave a review on your PR and point it our :) |
Co-authored-by: James Curtis <[email protected]>
Co-authored-by: James Curtis <[email protected]>
Co-authored-by: James Curtis <[email protected]>
|
Hi @arianbeh, It looks like your changes are not compiling (https://buildkite.com/firecracker/firecracker-pr/builds/15430#019b98cb-47c2-4d53-8b05-b4cefbbac739/L698). Could you please fix this and squash it into your original commit? |
Signed-off-by: Aryan Behmardi <[email protected]>
|
Hi @arianbeh, I notice you haven't engaged with this PR lately. Are you still making changes, or are you waiting for me to run tests? |
Hey, I did fix the compile issue and I belive I pushed it. I also accpeted your earlier comments believing it would add those to the code. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5577 +/- ##
=======================================
Coverage 83.23% 83.23%
=======================================
Files 277 277
Lines 29262 29284 +22
=======================================
+ Hits 24356 24376 +20
- Misses 4906 4908 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @arianbeh, It looks like style checks are failing due to rust formatting and commit messages. Rust formatting can be fixed using |
Changes
clippy::as_conversionslint at the workspace level by updatingCargo.toml.as_conversionsviolations across the workspace by:std::ptr::from_ref/std::ptr::from_mutwhere appropriate (e.g. in
cpu-template-helper).i64::from(),u64::try_from(), andusize::try_from().#[allow(clippy::as_conversions)]in low-level or constcontexts where
asis intentional and required (e.g., enum-to-byteencoding in ACPI AML, seccompiler const fns, and libc constant conversions).
truncation.
cpu-template-helperutils::timeacpi-tables(AML, DSDT, MADT, XSDT)seccompiler(bindings, types, lib)rebase-snapjailer(resource_limits)snapshot-editorfirecracker(main and examples)vmm(library, benches, and tests)Reason
This PR implements the final step of #3161, consolidating several
cast-related Clippy lints into
as_conversionsand fixing all violations.Enabling
as_conversionsensures:#[allow]where they are intentional and unavoidable.RUSTFLAGS="-Dwarnings".ascasts will be flagged consistently.All changes preserve existing behavior while making the code safer and more
explicit about type boundaries.
Verification
Locally ran:
RUSTFLAGS="-Dwarnings" cargo clippy --all --all-targetscargo fmtAll packages build clean with no Clippy warnings.
I was not able to run
tools/devtool checkbuildortools/devtool checkstylebecause
/dev/kvmis not available in my environment.Closes #3161.